import request from '@/utils/request';
let baseURL = 'property-portal/v1/api/tEnergyMeter/';

// 清单分类
export const getAllClassificationDataApi = () => {
    return request({
        url: `/budget/inventory/categoryDropdownTree`,
        method: 'get',
    });
};

//设备名称 - 物业
export const getDeveiceListApi = (data) => {
    return request({
        url: baseURL + `queryCommonDeviceList`,
        method: 'post',
        data: data,
    });
};

//设备名称 - 驾驶舱
export const getDeveiceDashbordListApi = (data) => {
    return request({
        url: baseURL + `queryBiCommonDeviceList`,
        method: 'post',
        data: data,
    });
};

// 驾驶舱-能源明细-电表-公区
const energyElectricitydashboardAreaListApi = data => {
    return request({
        url: baseURL + 'queryBiEnergyMeterCommonDeviceList',
        method: 'post',
        data: data,
    });
};

// 物业-能源明细-电表-公区
const energyElectricityListApi = data => {
    return request({
        url: baseURL + 'queryEnergyMeterCommonDeviceList',
        method: 'post',
        data: data,
    });
};

// 物业-能源明细-电表-商户
const energyElectricityBusinessListApi = data => {
    return request({
        url: baseURL + 'queryEnergyMeterCommerceDeviceList',
        method: 'post',
        data: data,
    });
};

// 物业-能源明细-电表-可选择的项目
const energyProjectListApi = data => {
    return request({
        url: baseURL + 'queryEnergyMeterCommonProjectList',
        method: 'post',
        data: data,
    });
};

// 公区能源-电表-导出
const energyElectricityExportApi = data => {
    return request({
        url: '',
        method: 'post',
        data: data,
        responseType: 'blob',
    });
};

// 主体配置
const mainConfigListApi = data => {
    return request({
        url: baseURL + 'queryEnergyMeterConfigList',
        method: 'post',
        data: data,
    });
};

//新增
const mainConfigAddApi = data => {
    return request({
        url: baseURL + 'createEnergyMeterConfig',
        method: 'post',
        data: data,
    });
};

//编辑
const mainConfigEditApi = data => {
    return request({
        url: baseURL + 'editEnergyMeterConfig',
        method: 'post',
        data: data,
    });
};

//详情
const mainConfigInfoApi = data => {
    return request({
        url: baseURL + 'viewEnergyMeterConfig',
        method: 'post',
        data: data,
    });
};

// 解析Cron表达式
const parseFrequencyApi = data => {
    return request({
        url: baseURL + 'parseFrequency',
        method: 'post',
        data: data,
    });
};

// 设备台账 朝合公区电表 | 商户电表
const facilityStandingListApi = data => {
    return request({
        url: baseURL + 'queryEnergyMeterList',
        method: 'post',
        data: data,
    });
};

// 设备台账 物业 - 公区
const facilityStandingPropertyAreaListApi = data => {
    return request({
        url: baseURL + 'queryEnergyMeterConfigNoList',
        method: 'post',
        data: data,
    });
};

// 执行日志
const doLogListApi = data => {
    return request({
        url: baseURL + 'queryEnergyMeterDetailList',
        method: 'post',
        data: data,
    });
};

// 执行日志 - 详情
const doLogInfoApi = data => {
    return request({
        url: baseURL + 'findEnergyMeterDetailConfigNoInfo',
        method: 'post',
        data: data,
    });
};

// 执行日志 - 详情
const doLogInfoChaoheApi = data => {
    return request({
        url: baseURL + 'findEnergyMeterDetailInfo',
        method: 'post',
        data: data,
    });
};

// 立即同步-设备台账
const syncDoApi = data => {
    return request({
        url: baseURL + 'saveEnergyMeter',
        method: 'post',
        data: data,
    });
};

// 立即同步-执行日志
const syncDoLogApi = data => {
    return request({
        url: baseURL + 'syncEnergyMeterConfigNo',
        method: 'post',
        data: data,
    });
};

// 项目列表
const projectListApi = params => {
    return request({
        url: `/property-portal/v1/api/electricMeter/queryProjectList`,
        method: 'post',
        data: params,
    });
};

// 监控大屏 - 公区 - 实时用电
const electroRealTime = params => {
    return request({
        url: `/property-portal/v1/api/tEnergyControl/queryAdsSubjectEnergyMeterDetailList`,
        method: 'post',
        data: params,
    });
};

// 能源消耗统计表 - 物业
const energyConsumptionReportApi = params => {
    return request({
        url: `/portal-server/v1/api/propertySpecialReport/queryProjectPropertySpecialReportList`,
        method: 'post',
        data: params,
    });
};

export default {
    getAllClassificationDataApi,
    getDeveiceListApi,
    getDeveiceDashbordListApi,
    energyElectricitydashboardAreaListApi,
    energyElectricityListApi,
    energyElectricityBusinessListApi,
    energyElectricityExportApi,
    mainConfigListApi,
    facilityStandingListApi,
    doLogListApi,
    syncDoApi,
    syncDoLogApi,
    doLogInfoApi,
    doLogInfoChaoheApi,
    projectListApi,
    electroRealTime,
    energyConsumptionReportApi,
    parseFrequencyApi,
    mainConfigAddApi,
    mainConfigEditApi,
    mainConfigInfoApi,
    energyProjectListApi,
    facilityStandingPropertyAreaListApi
};
